{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "3d374bff",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python 3.10.0\r\n"
     ]
    }
   ],
   "source": [
    "!python3 --version"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "11ab7fe7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hello worlda"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'\\n# 多行注释 \" \\'\\n# 单行注释 #\\nprint函数-参数1：要打印的内容  参数2：end 以什么结尾\\n\\n'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 我的第一个输出 ： print\n",
    "print(\"Hello world\")\n",
    "\n",
    "'''\n",
    "# 多行注释 三个\" 或者 三个'\n",
    "# 单行注释 #\n",
    "print函数-参数1：要打印的内容  参数2：end 以什么结尾\n",
    "字符串 用 \" '  str\n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "b362fa02",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入一个666：123\n"
     ]
    }
   ],
   "source": [
    "# 我的第一个输入：input\n",
    "a = input(\"请输入一个666：\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "aff1dfcb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'123'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1a590b22",
   "metadata": {},
   "outputs": [],
   "source": [
    "'''\n",
    "a 是个变量，用来存储数据\n",
    "input 参数：提示用户输入什么东西\n",
    "      返回值：就是我们输入的内容，默认是字符串类型的数据\n",
    "= 等于号，表示赋值   \n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "6f5dd85d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'hhhhh\\naaa'"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b = '''hhhhh\n",
    "aaa'''\n",
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "81361e05",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(b)\n",
    "# 怎么查看一个变量的数据类型：type() 参数：要查看的变量名称"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "4c36b973",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 代码格式的详解\n",
    "def find_ab(a, b):\n",
    "    flag = 0\n",
    "    for i in range(len(a)):\n",
    "        for j in range(len(b)):\n",
    "            # print(i ,j , len(b)-1, b[j], a[i+j])\n",
    "            if b[j] == a[i+j]: \n",
    "                # 两个元素相等 且为b的最后一个元素，说明a包含b\n",
    "                if j == len(b)-1:\n",
    "                    return True\n",
    "                # 两个元素相等 但是还没遍历完b，则继续遍历\n",
    "                continue\n",
    "            else: # 两个元素不相等，直接往后遍历a再开始比较\n",
    "                break\n",
    "    # 没找到，返回False    \n",
    "    return False\n",
    "\n",
    "a = \"welc ometomy world\"\n",
    "b = \"worl\"\n",
    "find_ab(a, b)     "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ae65f319",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
